/**
 * 
 */

package direct;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import common.UserBean;

/**
 * url: http://127.0.0.1:8080/ExcelExport/direct/directExport<br>
 * <br>
 * 這是最快產生 excel 報表的方式, 先在 excel 編輯格式, 再將存成 .html 格式, 再轉換成 .jsp, 就完成. 但要記得設定 content-type, 設定如下:<br>
 * 1. text/html: 直接顯示在 IE 上.<br>
 * 2. application/vnd.ms-excel: 問是否開啟 excel, 或者存當, 正確做法, 以這個為準<br>
 * 
 * @author Grady.Kao
 * @version 1.0
 * @company E885 Group
 * @copyright Copyright (c) 2000-2008
 */

public class DirectExportServlet extends HttpServlet
{
	private static final long serialVersionUID = -5261082560981150574L;

	/*
	 * (non-Javadoc)
	 * 
	 * @see javax.servlet.http.HttpServlet#service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 */
	@Override
	protected void service( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException
	{
		UserBean bean = new UserBean();
		bean.setName( "Grady.Kao" );
		bean.setPassword( "1234" );
		
		request.setAttribute( "Bean", bean );

		request.getRequestDispatcher( "/direct/directInfo.jsp" ).forward( request, response );
	}
}
